<template>
  <transition name="modal-fade">
    <view class="modal-mask" v-show="visible" @click.stop="close">
      <view class="modal-container">
        <image 
          :src="sheep.$url.cdn('/storage/default/20250419/24e0c5fcac58943520508d742c80cc9b.png')"
          mode="widthFix" 
          class="modal-image" />
        <view class="modal-header">{{ title }}</view>
        
        <view class="modal-body">
          <!-- <slot></slot> -->
          商品已铺货，您可到铺货记录查看
        </view>
        
        <view class="modal-footer" @click="close">去入驻</view>
      </view>
    </view>
  </transition>
</template>

<script setup>
import { ref, watch } from 'vue'
import sheep from '@/sheep'
const props = defineProps({
  visible: {
    type: Boolean,
    default: false
  },
  title: {
    type: String,
    default: '铺货成功'
  }
})

const emit = defineEmits(['close'])

const close = () => {
  emit('update:visible', false);
  emit('close');
}

watch(
  () => props.visible,
  (newVal) => {
    document.body.style.overflow = newVal ? 'hidden' : ''
  }
)

</script>

<style scoped lang="scss">
/* 蒙版样式 */
.modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9998;
  transition: opacity 0.3s ease;
}

/* 弹框容器 */
.modal-container {
  width: 650rpx;
  height: 430rpx;
  background: linear-gradient(180deg, #D4E1FF 0%, #FFFFFF 41%);
  box-shadow: 0px 4px 50px 0px rgba(0, 0, 0, 0.3);
  border-radius: 20rpx;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
}

.modal-image {
  width: 176rpx;
  height: 168rpx;
  position: absolute;
  top: 0rpx;
  left: 50%;
  transform: translateX(-50%);

}

/* 弹框头部 */
.modal-header {
 font-size: 36rpx;
 font-weight: bold;
 text-align: center;
 color: #171717;
 margin-top: -80rpx;
}


/* 弹框内容 */
.modal-body {
  font-size: 30rpx;
  color: #929292;
  font-weight: 400;
  text-align: center;
  margin-top: 20rpx;
}

/* 弹框底部 */
.modal-footer {
  border-top: 1px solid #f0f0f0;
  text-align: right;
  cursor: pointer;
  transition: background-color 0.2s;
  background-color: #426DFA;
  color: #fff;
  border-radius: 100rpx;
  font-size: 30rpx;
  font-weight: bold;
  margin: 40rpx 86rpx 77rpx 86rpx;
  text-align: center;
  height: 90rpx;
  line-height: 90rpx;
  box-shadow: 0px 8px 50px 0px rgba(74, 116, 254, 0.41);
}
.modal-footer:hover {
  background-color: #66b1ff;
}



/* 动画效果 */
.modal-fade-enter-active,
.modal-fade-leave-active {
  transition: opacity 0.3s ease;
}

.modal-fade-enter,
.modal-fade-leave-to {
  opacity: 0;
}

.modal-fade-enter-active .modal-container,
.modal-fade-leave-active .modal-container {
  transition: transform 0.3s ease;
}

.modal-fade-enter .modal-container,
.modal-fade-leave-to .modal-container {
  transform: translateY(-20px);
}
</style>